// 动画切换属性面板属性项显示隐藏
const toggle = (el, isShow) => {
  if (isShow) {
    el.classList.remove('vs-field-hide');
    el.classList.add('vs-field-show');
  } else {
    el.classList.remove('vs-field-show');
    el.classList.add('vs-field-hide');
  }
};

export default {
  directives: {
    'vs-field-show': {
      mounted(el, binding) {
        toggle(el, binding.value);
      },
      updated(el, binding) {
        if (binding.value !== binding.oldValue) {
          toggle(el, binding.value);
        }
      },
    },
  },
};
